#pragma once

#include "EventListener.h"

#include <Windows.h>

#include <map>
#include <queue>
using namespace std;

class WhyEventSystem
{
	multimap<const char*, IEventListener*> clients;
	queue<IEventData*> events;

	bool AlreadyRegistered(const char* eventName, IEventListener* listener);

	HANDLE eventHandle;
	bool processing;

public:

	bool IsProcessing() { return processing; }

public:

	void Init();
	void Shutdown();

	void RegisterClient(const char* eventName, IEventListener* listener);

	void UnregisterClient(const char* eventName, IEventListener* listener);

	void UnregisterClientAll();

	void SendEvent(IEventData* eventdata);

	void ProcessEvents();
};